package xuesm.singleton.threadlocal;

/**
 * @Author: xuesm
 * @Description: threadlocal单例
 * @Date: Create in 11:53 2019/3/30
 */
public class ThreadLocalSingleton {

	private static final ThreadLocal<ThreadLocalSingleton> THREAD_LOCAL_INSTANCE =  new ThreadLocal<ThreadLocalSingleton>(){
		@Override
		protected ThreadLocalSingleton initialValue() {
			return new ThreadLocalSingleton();
		}

	};

	private ThreadLocalSingleton(){};


	public static ThreadLocalSingleton getInstance(){
		return THREAD_LOCAL_INSTANCE.get();
	}
}
